//
//  MessageCell.m
//  WGFGlobalHouses
//
//  Created by waiguofang on 15/7/10.
//  Copyright (c) 2015年 waiguofang. All rights reserved.
//

#import "MessageCell.h"
#import "StringTool.h"

@interface MessageCell()

@property (weak, nonatomic) IBOutlet UIImageView *img;
@property (weak, nonatomic) IBOutlet UILabel *titleLab;
@property (weak, nonatomic) IBOutlet UILabel *mesaageLab;
@property (weak, nonatomic) IBOutlet UILabel *messageDate;

@end

@implementation MessageCell

+(instancetype)cellWithTableView:(UITableView *)tableView{
    
    static NSString *ID = @"MessageCell";
    MessageCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (!cell) {
        
        cell = [[[NSBundle mainBundle]loadNibNamed:@"MessageCell" owner:nil options:nil]lastObject];
    }
    
    return cell;
}
+(CGFloat)getHeight{
    
    return 60;
}

-(void)setModel:(MessageModel *)model{
    
    _model = model;
    
    if (![StringTool isBlankString:model.messageTitle]) {
        
        self.titleLab.text = model.messageTitle;
    }
    if (![StringTool isBlankString:model.messageSub]) {
        
        self.mesaageLab.text = model.messageSub;
    }
    if (![StringTool isBlankString:model.messageTime]) {
        
        self.messageDate.text = model.messageTime;
    }
    
    if (model.messageType ==MessageTypeSYS) {
        
        [self.img setImage:[UIImage imageNamed:@"message14"]];
        
    }else if (model.messageType==MessageTypeACTIVITY){
        
        [self.img setImage:[UIImage imageNamed:@"message15"]];
        
    }else if (model.messageType==MessageTypeORDER){
        
        [self.img setImage:[UIImage imageNamed:@"message16"]];
    }
    
}

@end
